<%@ page language="java" contentType="text/html;UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@include file="../base.jsp" %>
<title>Insert title here</title>
<script type="text/javascript">
 $(function(){

$("input[type='file']").change(function(evt){

         var files = evt.target.files; 

 

         for (var i = 0, f; f = files[i]; i++) {

 

          if (!f.type.match('image.*')) {

            continue;

           }


           var reader = new FileReader();

 

          reader.onload = (function(theFile) {

             return function(e) {                                

             $("#list img").attr("src",e.target.result);  //Ԥ@ͼƬքλ׃                 

            };

          })(f);

 

         reader.readAsDataURL(f);

         }

     });

});

</script>
</head>
<body><!-- $!{base}/usersa/upimg.html -->
<form enctype="multipart/form-data" action="#" method="post">

  <input type="file" id="fil" name="fil"/><input type="submit" id="btm" value="上传"/>

  <div id="list"><img src=""></div>

</form>
</body>
</html>